﻿using SketchUpAPI.NET.Enums;
using SketchUpAPI.NET.SketchUp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SketchUpAPI.NET.Objects
{
    /// <summary>
    /// 单位选项设置器
    /// </summary>
    /// <remarks>该类型并不是 SketchUpAPI 中的类型，该类的目的是便于设置长度选项</remarks>
    public class OptionsProviderUnits : OptionsProvider
    {
        /// <summary>
        /// 格式
        /// </summary>
        public LengthFormatType LengthFormat
        {
            get
            {
                return (LengthFormatType)this["LengthFormat"].GetInt32();
            }
            set
            {
                TypedValue t = TypedValue.Create((int)value);
                this["LengthFormat"] = t;
            }
        }

        /// <summary>
        /// 长度单位
        /// </summary>
        public UnitLengthType LengthUnit
        {
            get
            {
                return (UnitLengthType)this["LengthUnit"].GetInt32();
            }
            set
            {
                TypedValue t = TypedValue.Create((int)value);
                this["LengthUnit"] = t;
            }
        }

        /// <summary>
        /// 长度精度
        /// </summary>
        public Precision LengthPrecision
        {
            get
            {
                return (Precision)this["LengthPrecision"].GetInt32();
            }
            set
            {
                TypedValue t = TypedValue.Create((int)value);
                this["LengthPrecision"] = t;
            }
        }

        /// <summary>
        /// 面积单位
        /// </summary>
        public UnitAreaType AreaUnit
        {
            get
            {
                return (UnitAreaType)this["AreaUnit"].GetInt32();
            }
            set
            {
                TypedValue t = TypedValue.Create((int)value);
                this["AreaUnit"] = t;
            }
        }

        /// <summary>
        /// 面积精度
        /// </summary>
        public Precision AreaPrecision
        {
            get
            {
                return (Precision)this["AreaPrecision"].GetInt32();
            }
            set
            {
                TypedValue t = TypedValue.Create((int)value);
                this["AreaPrecision"] = t;
            }
        }

        /// <summary>
        /// 体积单位
        /// </summary>
        public UnitVolumeType VolumeUnit
        {
            get
            {
                return (UnitVolumeType)this["VolumeUnit"].GetInt32();
            }
            set
            {
                TypedValue t = TypedValue.Create((int)value);
                this["VolumeUnit"] = t;
            }
        }

        /// <summary>
        /// 体积精度
        /// </summary>
        public Precision VolumePrecision
        {
            get
            {
                return (Precision)this["VolumePrecision"].GetInt32();
            }
            set
            {
                TypedValue t = TypedValue.Create((int)value);
                this["VolumePrecision"] = t;
            }
        }

        internal OptionsProviderUnits(OptionsProvider op)
        {
            this.Id = op.Id;
        }
    }
}